﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../scripts/boot.js" type="text/javascript"></script>
    <script type="text/javascript">
        $.ajax({
            url: "../data/system.aspx?method=102",
            async: false,
            success: function (text) {
                if (text == "no")
                    window.location = "../system/error.html";
                else if (text == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                    var tabs = parent.mini.get("mainTabs");
                    var tab = tabs.getTab("tab$102");
                    tabs.removeTab(tab);
                }
            }
        });
        var State = [{ id: 1, text: '<font color="Blue">通过</font>' }, { id: 2, text: '<font color="Red">不通过</font>'}]
        var States = [{ id: 0, text: '未审核' }, { id: 1, text: '已审通过' }, { id: 2, text: '已审未通过' }, { id: -1, text: '全部'}];
        var Types = [{ id: 0, text: '全部' }, { id: 1, text: '有效' }, { id: -1, text: '过期' }, { id: 2, text: '即将到期'}];
        var Color = [{ id: 'Default', text: '默认' }, { id: 'Red', text: '红色' }, { id: 'Blue', text: '蓝色' }, { id: 'Green', text: '绿色'}]
    </script>
</head>
<body>
    <div class="mini-fit">
        <div id="divList" class="mini-fit">
            <div class="mini-toolbar" style="border-bottom: 0;">
                <table >
                    <tr>
                        <td>
                            单位:
                            <input class="mini-textbox" id="key" style="width:140px" emptytext="用户名或单位名称关键字"/>
                            会员等级:
                            <input id="level" style="width:80px" class="mini-combobox" url="../data/system.aspx?method=CbxComType" textField="cl_name" valueField="cl_id" value="0"/>
                            有效:
                            <input id="type" style="width:80px" class="mini-combobox" data="Types" value="0"/>
                            状态:
                            <input id="state" style="width:90px" class="mini-combobox" data="States" value="0"/>
                            审核日期：
                            <input id="sdate" class="mini-datepicker" style="width:100px" />
                            至
                            <input id="edate" class="mini-datepicker" style="width:100px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            所属行业:
                            <input id="trade" style="width:180px" class="mini-combobox" url="../data/system.aspx?method=CbxTradeAll" textField="di_name" valueField="di_code" value="0"/>
                            企业性质：
                            <input id="property" style="width:120px" class="mini-combobox" url="../data/system.aspx?method=CbxPopertyAll" textField="di_name" valueField="di_code" value="0"/>
                            所在地区：
                            <input id="area" style="width:90px" class="mini-combobox" url="../data/system.aspx?method=CbxAreaNoAll" textField="di_name" valueField="di_code" value="0"/>
                            登录日期：
                            <input id="logins" class="mini-datepicker" style="width:100px" />
                            至
                            <input id="logine" class="mini-datepicker" style="width:100px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a class="mini-button" iconcls="icon-search" plain="true" onclick="search()">查询</a>
                            <!--<a class="mini-button" plain="true" iconcls="icon-excel" onclick="excelRow()">查询结果手机号导出</a>-->
                            <span class="separator"></span>
                            <a class="mini-button" plain="true" iconcls="icon-add" onclick="addNewPay()">新增缴费</a>
                            <!--<a class="mini-button" plain="true" iconcls="icon-remove" onclick="delRows()">删除缴费</a>
                            <a class="mini-button" plain="true" iconcls="icon-search" onclick="delRows()">已缴费用</a>-->
                            <!--<span class="separator"></span>
                            <a class="mini-button" plain="true" iconcls="icon-ok" onclick="checkRows(1)">审核通过</a>
                            <a class="mini-button" plain="true" iconcls="icon-no" onclick="checkRows(2)">审核不通过</a>
                            <span class="separator"></span>
                            <a class="mini-button" plain="true" iconcls="icon-lock" onclick="lockRows(1)">隐藏</a>
                            <a class="mini-button" plain="true" iconcls="icon-unlock" onclick="lockRows(0)">显示</a>
                            <span class="separator"></span>
                            <a class="mini-button" plain="true" iconcls="icon-tip" onclick="freeRows(1)">免审</a>
                            <a class="mini-button" plain="true" iconcls="icon-undo" onclick="freeRows(0)">取消</a>
                            <span class="separator"></span>
                            <a class="mini-button" plain="true" iconcls="icon-miaose" onclick="colorRows(1)">描色</a>-->
                        </td>
                    </tr>
                </table>
            </div>
            <div class="mini-fit">
                <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%;" allowresize="true"
                    url="../data/system.aspx?method=GetCompanyList" idfield="cu_no" sizeList="[15,20,50,100]" pageSize="15">
                    <div property="columns">
                        <div type="checkcolumn">
                        </div>
                        <div cellCls="actionIcons" name="action" width="60px" headeralign="center" align="center" renderer="onActionRenderer" cellstyle="padding:0;">操作</div>
                        <div field="cu_name" headeralign="center" align="center" allowsort="true" renderer="onNameRenderer">单位名称</div>
                        <div field="cl_name" width="60px" headeralign="center" align="center" allowsort="true">会员类型</div>
                        <div field="cu_state" width="70px" align="center" headeralign="center" allowsort="true" renderer="onStateRenderer">会员状态</div>
                        <div field="cu_ok" width="40px" align="center" headeralign="center" allowsort="true" renderer="onOkRenderer">免审</div>
                        <div field="cu_effecttime" width="50px" align="center" headeralign="center" allowsort="true" renderer="onEffectRenderer">有效期</div>
                        <div field="cu_apptime" width="80px" align="center" allowsort="true" headeralign="center" dateformat="yyyy-MM-dd">审核时间</div>
                        <div field="cu_endtime" width="80px" align="center" allowsort="true" headeralign="center" dateformat="yyyy-MM-dd">到期时间</div>
                        <div field="cu_zhengjian" width="60px" align="center" headeralign="center" allowsort="true" renderer="onLicenseRenderer">营业执照</div>
<!--                        <div field="re_count" width="70px" headeralign="center" align="center" renderer="onRecruitRenderer">
                            招聘</div>
                        <div field="app_count" width="70px" headeralign="center" align="center" renderer="onAppRenderer">
                            审核记录</div>
                        <div field="pay_count" width="70px" headeralign="center" align="center" renderer="onMoneyRenderer">
                            缴费</div>-->
                        <div field="trade" width="180px" headeralign="center" align="center" allowsort="true">所属行业</div>
                        <div field="property" width="100px" headeralign="center" align="center" allowsort="true">企业性质</div>
                        <div field="area" width="80px" headeralign="center" align="center" allowsort="true">所在地区</div>
                        <div field="cu_logintime" width="80px" align="center" allowsort="true" headeralign="center" dateformat="yyyy-MM-dd">最后登录时间</div>
                        <div field="cu_msgname" width="80px" headeralign="center" align="center" allowsort="true">联系人</div>
                        <div field="cu_msgmobile" width="80px" headeralign="center" align="center" allowsort="true">手机</div>
                    </div>
                </div>
            </div>
        </div>
        <div id="editForm" class="form" style="display: none">
            <fieldset style="border: solid 1px #aaa; width: 720px">
                <legend><strong>企业详细信息</strong><span class="red">( 带 * 号的必须填写)</span></legend>
                <input class="mini-hidden" name="cu_no" id="cu_no"/>
                <table style="padding:5px; width: 100%; ">
                    <tr>
                        <td class="tdtitle" style="width: 100px;">
                            <span style="color: Red">*</span>&nbsp;&nbsp;用户名：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_user" style="width: 280px" required="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <input name="cu_ok" class="mini-checkbox" text="免审"/>
                            <a class="mini-button" style="width:80px;" onclick="resetPass()" >密码重置</a>
                        </td>
                    </tr>
                    <tr id="trpass">
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;密码：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_password" style="width: 280px" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;单位名称：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_name" style="width: 280px" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;营业执照：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_license" style="width: 280px" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;企业性质：
                        </td>
                        <td colspan="3">
                            <input class="mini-combobox" style="width: 180px;" name="cu_property" textfield="di_name"
                                required="true" valuefield="di_code" url="../data/system.aspx?method=CbxPoperty" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;所在地区：
                        </td>
                        <td colspan="3">
                            <input class="mini-combobox" style="width: 180px;" name="cu_area" textfield="di_name"
                                required="true" valuefield="di_code" url="../data/system.aspx?method=CbxAreaNo" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;所属产业：
                        </td>
                        <td colspan="3">
                          <input name="cu_industry" class="mini-checkboxlist" data="CompanyIndustry" required="true" repeatItems="3" repeatLayout="table"/>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;所属行业：
                        </td>
                        <td colspan="3">
                            <input class="mini-combobox" style="width: 180px;" name="cu_trade" textfield="di_name"
                                required="true" valuefield="di_code" url="../data/system.aspx?method=CbxTrade" />
                        </td>
                    </tr>
                     <tr>
                        <td class="tdtitle">
                            荣誉称号：
                        </td>
                        <td colspan="3">
                          <input name="cu_category" class="mini-checkboxlist" data="CompanyCategory"  repeatItems="3" repeatLayout="table"/>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;单位地址：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_address" style="width: 280px" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;联系人：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_contact" style="width: 280px" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            <span style="color: Red">*</span>&nbsp;&nbsp;联系电话：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_tel" style="width: 280px" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            传真：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_fax" style="width: 280px" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            电子邮箱：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_email" vtype="email" style="width: 280px" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            企业网址：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_url" style="width: 280px" />
                        </td>
                    </tr>
                    <tr class="trkind">
                        <td class="tdtitle" style="width: 100px;">
                             <span style="color: Red">*</span>&nbsp;&nbsp;会员类型：
                        </td>
                        <td style="width: 250px;">
                            <input name="cu_kind" class="mini-combobox" textfield="cl_name" valuefield="cl_id" url="../data/system.aspx?method=CbxLevel" required="true"  style="width: 130px"/>
                        </td>
                        <td class="tdtitle" style="width: 100px;">
                             <span style="color: Red">*</span>&nbsp;&nbsp;有效期：
                        </td>
                        <td style="width: 250px;">
                            <input class="mini-textbox" name="cu_effecttime" vtype="int" required="true" style="width: 130px"/>&nbsp;天
                        </td>
                    </tr>
                    <tr class="trkind">
                        <td class="tdtitle">是否缴费：</td>
                        <td>
                            <input class="mini-checkbox" name="cu_ismoney"/>
                        </td>
                        <td class="tdtitle">金额：</td>
                        <td>
                            <input class="mini-spinner" minValue="0" maxValue="999999" changeOnMousewheel="false" name="cm_money"/>&nbsp;元
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            企业简介：
                        </td>
                        <td colspan="3">
                            <input class="mini-textarea" name="cu_introduce" style="width: 570px; height: 80px" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            联系人：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_msgname" style="width: 280px" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            手机：
                        </td>
                        <td colspan="3">
                            <input class="mini-textbox" name="cu_msgmobile" style="width: 280px"  />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" style="text-align:center;padding:5px;">
                            <a class="mini-button" style="width:60px;" onclick="updateRow()" >保存</a>
                            <span style="display:inline-block;width:25px;"></span>
                            <a class="mini-button" style="width:60px;" onclick="cancelRow()">取消</a>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </div>
        <div id="checkWindow" class="mini-window" title="审核会员信息<span class='red'>( 带 * 号的必须填写)</span>" style="width: 360px;" showmodal="true"
            allowresize="false" allowdrag="true" showfooter="true">
            <div id="checkform" class="form">
                <input class="mini-hidden" name="cu_no" />
                <table style="width: 100%;">
                    <tr>
                        <td class="tdtitle" width="80px">单位名称：</td>
                        <td style="color: Blue">
                            <div id="check">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle"><span class="red">*</span>审核：</td>
                        <td>
                            <input id="cu_state" name="cu_state" class="mini-radiobuttonlist" repeatlayout="table" repeatdirection="vertical"
                                data="State" required="true"/>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle"><span class="red">*</span>会员类型：</td>
                        <td>
                            <input name="cu_kind" class="mini-combobox" textfield="cl_name" valuefield="cl_id" url="../data/system.aspx?method=CbxLevel" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle"><span class="red">*</span>有效期：</td>
                        <td>
                            <input class="mini-textbox" name="cu_effecttime" required="true" />&nbsp;天
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">是否缴费：</td>
                        <td>
                            <input class="mini-checkbox" id="cu_ismoney" name="cu_ismoney"/>
                        </td>
                    </tr>
                    <tr class="tr1">
                      <td class="tdtitle">金额：</td>
                        <td>
                            <input class="mini-spinner" minValue="0" maxValue="999999" changeOnMousewheel="false" name="cm_money"/>&nbsp;元
                        </td>
                    </tr>
                    <tr class="tr1">
                        <td class="tdtitle">备注：</td>
                        <td>
                            <input class="mini-textarea" name="cm_memo" width="180px" height="60px" />
                        </td>
                    </tr>
                </table>
            </div>
            <div property="footer" style="text-align: center; padding: 5px;">
                <a class="mini-button" style="width: 80px;" onclick="updateCheck()">确认审核</a>
                <span style="display: inline-block; width: 25px;"></span>
                <a class="mini-button" style="width: 60px;" onclick="closeCheck()">关闭</a>
            </div>
        </div>
        <div id="payWindow" class="mini-window" title="新增缴费信息<span class='red'>( 带 * 号的必须填写)</span>" style="width: 360px;" showmodal="true"
            allowresize="false" allowdrag="true" showfooter="true">
            <div id="payform" class="form">
                <input class="mini-hidden" name="cu_no" />
                <table style="width: 100%;">
                    <tr>
                        <td class="tdtitle" width="80px">单位名称： </td>
                        <td style="color: Blue">
                            <div id="pay">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle">
                            会员类型：
                        </td>
                        <td>
                            <div id="kind"></div>
                        </td>
                    </tr>
                    <tr>
                      <td class="tdtitle"><span class="red">*</span>金额：</td>
                        <td>
                            <input class="mini-spinner" minValue="0" maxValue="999999" changeOnMousewheel="false" name="cm_money" required="true" />&nbsp;元
                        </td>
                    </tr>
                    <tr>
                        <td class="tdtitle"> 备注：</td>
                        <td>
                            <input class="mini-textarea" name="cm_memo" width="180px" height="60px" />
                        </td>
                    </tr>
                </table>
            </div>
            <div property="footer" style="text-align: center; padding: 5px;">
                <a class="mini-button" style="width: 60px;" onclick="updatePay()">保存</a>
                <span style="display: inline-block; width: 25px;"></span>
                <a class="mini-button" style="width: 60px;" onclick="closePay()">关闭</a>
            </div>
        </div>
        <div id="colorWindow" class="mini-window" title="企业描色<span class='red'>( 带 * 号的必须填写)</span>" style="width: 260px;" showmodal="true"
            allowresize="false" allowdrag="true" showfooter="true">
            <div id="colorform" class="form">
                <table style="width: 100%;">
                    <tr>
                      <td class="tdtitle"><span class="red">*</span>颜色：</td>
                        <td>
                            <input name="cu_color" class="mini-combobox" data="Color" required="true" value="Black"/>
                        </td>
                    </tr>
                </table>
            </div>
            <div property="footer" style="text-align: center; padding: 5px;">
                <a class="mini-button" style="width: 60px;" onclick="updateColor()">保存</a>
                <span style="display: inline-block; width: 25px;"></span>
                <a class="mini-button" style="width: 60px;" onclick="closeColor()">关闭</a>
            </div>
        </div>
    </div>
    <iframe id="exportIFrame" style="display:none;"></iframe>
    <!--导出Excel相关HTML-->
     <form id="excelForm" action="../data/download.aspx?method=ExcelCompanyTel" method="post" target="excelIFrame">
        <input type="hidden" name="key" id="Hidden1" />
        <input type="hidden" name="level" id="Hidden2" />
        <input type="hidden" name="type" id="Hidden3" />
        <input type="hidden" name="state" id="Hidden4" />
        <input type="hidden" name="sdate" id="Hidden5" />
        <input type="hidden" name="edate" id="Hidden6" />
        <input type="hidden" name="trade" id="Hidden7" />
        <input type="hidden" name="property" id="Hidden8" />
        <input type="hidden" name="area" id="Hidden9" />
        <input type="hidden" name="logins" id="Hidden10" />
        <input type="hidden" name="logine" id="Hidden11" />
    </form>
    <iframe id="excelIFrame" name="excelIFrame" style="display:none;"></iframe>
</body>
    <script type="text/javascript">
        $.ajaxSetup({
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            complete: function (XMLHttpRequest, textStatus) {
                if (XMLHttpRequest.responseText == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                }
            }
        });

        mini.parse();
        var grid = mini.get("datagrid1");
        search();

        function addNewPay() {

            var row = grid.getSelected();
            
            if (row) {
                mini.open({
                    url: bootPATH + "../payservice/selectService.html",
                    title: "新增企业缴费", width: 800, height: 560,
                    onload: function () {
                        var iframe = this.getIFrameEl();
                        var data = { action: "add", row: row };
                        iframe.contentWindow.SetData(data);
                        var json = mini.encode(data);
                        console.log(json);
                        
                    },
                    ondestroy: function (action) {
                        grid.reload();

                    }
                });

            } else {
                mini.alert("请先选择需缴纳费用的企业！", "Warning!");
            }

        }
        
//        function addNewPay() {
//            if (null == grid.getSelected()) {
//                mini.alert("请先选择需缴纳费用的企业！", "Warning!");
//            } else {
//                mini.open({
//                    url: bootPATH + "../demo/CommonLibs/EmployeeWindow.html",
//                    title: "编辑员工", width: 600, height: 360,
//                    onload: function () {
//                        var iframe = this.getIFrameEl();
//                        var data = { action: "edit", id: row.id };
//                        iframe.contentWindow.SetData(data);

//                    },
//                    ondestroy: function (action) {
//                        grid.reload();

//                    }
//                });
//                
//                var data = grid.getSelected();
//                var json = mini.encode(data);
//                $.ajax({
//                    url: "../data/payservice.aspx",
//                    data: { method: "addNewPay", data: data },
//                    async: "true",
//                    type: "post",
//                    success: function (result) {
//                        alert(result);
//                    }
//                });
//            }
//        }
        

        //查询
        function search() {
            var key = mini.get("key").getValue();
            var level = mini.get("level").getValue();
            var type = mini.get("type").getValue();
            var state = mini.get("state").getValue();
            var sdate = mini.get("sdate").getText();
            var edate = mini.get("edate").getText();
            var trade = mini.get("trade").getValue();
            var property = mini.get("property").getValue();
            var area = mini.get("area").getValue();
            var logins = mini.get("logins").getText();
            var logine = mini.get("logine").getText();

            $("#Hidden1").val(key);
            $("#Hidden2").val(level);
            $("#Hidden3").val(type);
            $("#Hidden4").val(state);
            $("#Hidden5").val(sdate);
            $("#Hidden6").val(edate);
            $("#Hidden7").val(trade);
            $("#Hidden8").val(property);
            $("#Hidden9").val(area);
            $("#Hidden10").val(logins);
            $("#Hidden11").val(logine);
            grid.load({ key: key, level: level, type: type, state: state, sdate: sdate, edate: edate, trade: trade, property: property, area: area, logins: logins, logine: logine });
            grid.sortBy("cu_no", "desc");
        }

        //单位名称显示
        function onNameRenderer(e) {
            var record = e.record;
            //            var s = '<a class="noline" style="color:Black" target="_blank" href="../../Web/Company/' + record.cu_no + '.html" title="编  号：' + record.cu_no + '&#13用户名：' + record.cu_user + '">' + record.cu_name + '</a>';
            //            if (record.cu_color != null)
            //                s = '<a class="noline" style="color:' + record.cu_color + '" target="_blank" href="../../Web/Company/' + record.cu_no + '.html" title="编  号：' + record.cu_no + '&#13用户名：' + record.cu_user + '">' + record.cu_name + '</a>';
            var s = '<a class="noline" style="color:Black" title="编  号：' + record.cu_no + '&#13用户名：' + record.cu_user + '">' + record.cu_name + '</a>';
            if (record.cu_color != null && record.cu_color != 'Default')
                s = '<a class="noline" style="color:' + record.cu_color + '" title="编  号：' + record.cu_no + '&#13用户名：' + record.cu_user + '">' + record.cu_name + '</a>';
            if (record.cu_hide == 1) {
                s = s + "<span style='color:Red'>[隐]</span>";
            }
            //            if (record.cu_state == 1) {
            //                var myDate = new Date();

            //                if (record.cu_endtime < myDate) {
            //                    s = s + "<span style='color:#cccccc'>[过期]</span>";
            //                }
            //            }
            return s;
        }

        //会员状态显示
        function onStateRenderer(e) {
            var record = e.record;
            var s;
            if (record.cu_state == 1)
                s = '<a class="linelinkgreen" title="审核" href="javascript:void(0);" onclick="openCheck(' + record._uid + ')">已审通过</a>';
            else if (record.cu_state == 2)
                s = '<a class="linelinkred" title="审核" href="javascript:void(0);" onclick="openCheck(' + record._uid + ')">已审未通过</a>';
            else
                s = '<a class="linelink" title="审核" href="javascript:void(0);" onclick="openCheck(' + record._uid + ')">未审核</a>';
            return s;
        }

        //免审显示
        function onOkRenderer(e) {
            var s;
            if (e.value == 1)
                s = '<font color="Green">是</font>';
            else
                s = '<font color="Red">否</font>';
            return s;
        }

        //单位名称显示
        function onEffectRenderer(e) {
            var record = e.record;
            var s = e.value;
            var myDate = new Date();
            if (record.cu_endtime < myDate)
                s = s + "<span style='color:#cccccc'>[过期]</span>";
            return s;
        }

        //营业执照显示
        function onLicenseRenderer(e) {
            if (e.value == "" || e.value == null)
                return "未上传";
            else
                return '<a class="linelink" title="查看" href="' + e.value + '" target="_blank">查看</a>';
        }

        //招聘显示
        function onRecruitRenderer(e) {
            var s = '<a class="linelink" title="详细" href="javascript:void(0);" onclick="recruitRows(' + e.record._uid + ')">管理</a> (' + e.value + ')';
            return s;
        }

        //审核记录显示
        function onAppRenderer(e) {
            var s = '<a class="linelink" title="详细" href="javascript:void(0);" onclick="appRows(' + e.record._uid + ')">查看</a> (' + e.value + ')';
            return s;
        }

        //缴费显示
        function onMoneyRenderer(e) {
            //var s = '<a class="linelink" title="详细" href="javascript:void(0);" onclick="openPay(' + e.record._uid + ')">添加</a><span class="separator"></span><a class="linelink" title="详细" href="javascript:void(0);" onclick="payRows(' + e.record._uid + ')">管理</a>';
            var s = '<a class="linelink" title="详细" href="javascript:void(0);" onclick="payRows(' + e.record._uid + ')">管理</a> (' + e.value + ')';
            return s;
        }

        //新增招聘企业
        function addRow() {
            var form = new mini.Form("#editForm");
            form.reset();
            mini.getbyName("cu_user").enable();
            $("#trpass").show();
            $(".trkind").show();
            $("#editForm").show();
            $("#divList").hide();
        }

        //修改招聘企业
        function editRow(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var form = new mini.Form("#editForm");
                form.loading();
                form.clear();
                $("#trpass").hide();
                $(".trkind").hide();
                $("#editForm").show();
                $("#divList").hide();
                $.ajax({
                    url: "../data/system.aspx?method=GetCompany",
                    data: { id: row.cu_no },
                    success: function (text) {
                        form.unmask();
                        if (text == "out") {
                            $("#divList").show();
                            $("#editForm").hide();
                            var loginWindow = parent.mini.get("loginWindow");
                            if (!loginWindow.visible)
                                loginWindow.show();
                            return;
                        }
                        var o = mini.decode(text);
                        form.setData(o);
                        mini.getbyName("cu_user").disable();
                    },
                    error: function () {
                        form.unmask();
                        ShowMessage("系统提示", "信息加载出错！", 3);
                    }
                });
            }
        }

        //保存招聘企业
        function updateRow() {
            var form = new mini.Form("#editForm");
            form.validate();
            if (form.isValid() == false)
                return;
            var o = form.getData();
            var json = mini.encode(o);
            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '保存中，请稍后...' });

            $.ajax({
                url: "../data/system.aspx?method=SaveCompany",
                type: "post",
                data: { data: json },
                success: function (ret) {
                    mini.unmask(document.body);
                    if (ret == "out") {
                        var loginWindow = parent.mini.get("loginWindow");
                        if (!loginWindow.visible)
                            loginWindow.show();
                        return;
                    }
                    if (ret == 1) {
                        $("#divList").show();
                        $("#editForm").hide();
                        form.clear();
                        ShowMessage("系统提示", "招聘企业保存成功！", 1);
                        grid.reload();
                    }
                    else if (ret == 0) {
                        $("#divList").show();
                        $("#editForm").hide();
                        form.clear();
                        ShowMessage("系统提示", "该招聘企业已不存在，请确认！", 2);
                        grid.reload();
                        creatHtml();
                    }
                    else if (ret == 2) {
                        ShowMessage("系统提示", "该招聘企业已存在，请确认！", 2);
                    }
                    else
                        ShowMessage("系统提示", "招聘企业保存失败！", 3);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    mini.unmask(document.body);
                    ShowMessage("系统提示", "招聘企业保存失败！", 3);
                }
            });
        }

        //取消招聘企业
        function cancelRow() {
            var form = new mini.Form("#editForm");
            form.clear();
            $("#divList").show();
            $("#editForm").hide();
        }

        //删除招聘企业
        function delRow(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                mini.confirm("删除招聘企业的同时将会删除该企业的相关信息，<br>确定删除该招聘企业吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '删除中，请稍后...' });
                            $.ajax({
                                url: "../data/system.aspx?method=DeleteCompany",
                                data: { id: row.cu_no },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "招聘企业删除成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "招聘企业删除失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "招聘企业删除失败！", 3);
                                }
                            });
                        }
                    }
                );
            }
        }

        //批量删除招聘企业
        function delRows() {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                mini.confirm("删除招聘企业的同时会删除企业的相关信息录，<br>确定删除所选招聘企业吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '删除中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].cu_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=DeleteCompany",
                                type: "post",
                                data: { id: ids },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "招聘企业删除成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "招聘企业删除失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "招聘企业删除失败！", 3);
                                }
                            });
                        }
                    }
                );
            } else
                ShowMessage("系统提示", "请选择需要删除的招聘企业！", 2);
        }

        //批量审核招聘企业
//        function checkRows(state) {
//            var rows = grid.getSelecteds();
//            if (rows.length > 0) {
//                mini.confirm("确定审核所选招聘企业吗？", "系统提示",
//                    function (action) {
//                        if (action == "ok") {
//                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
//                            var ids = "";
//                            for (var i = 0; i < rows.length; i++) {
//                                ids += rows[i].cu_no + ',';
//                            }

//                            $.ajax({
//                                url: "../data/system.aspx?method=CheckCompany",
//                                type: "post",
//                                data: { id: ids, state: state },
//                                success: function (ret) {
//                                    mini.unmask(document.body);
//                                    if (ret == "out") {
//                                        var loginWindow = parent.mini.get("loginWindow");
//                                        if (!loginWindow.visible)
//                                            loginWindow.show();
//                                        return;
//                                    }
//                                    if (ret >= 0) {
//                                        ShowMessage("系统提示", "招聘企业审核成功！", 1);
//                                        grid.reload();
//                                        creatHtml();
//                                    }
//                                    else
//                                        ShowMessage("系统提示", "招聘企业审核失败！", 3);
//                                },
//                                error: function (XMLHttpRequest, textStatus, errorThrown) {
//                                    mini.unmask(document.body);
//                                    ShowMessage("系统提示", "招聘企业审核失败！", 3);
//                                }
//                            });
//                        }
//                    }
//                );
//            } else
//                ShowMessage("系统提示", "请选择需要审核的招聘企业！", 2);
//        }

        //批量隐藏/显示招聘企业
//        function lockRows(state) {
//            var rows = grid.getSelecteds();
//            var msg = "隐藏";
//            if (state == 0)
//                msg = "显示";
//            if (rows.length > 0) {
//                mini.confirm("确定" + msg + "所选招聘企业吗？", "系统提示",
//                    function (action) {
//                        if (action == "ok") {
//                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
//                            var ids = "";
//                            for (var i = 0; i < rows.length; i++) {
//                                ids += rows[i].cu_no + ',';
//                            }

//                            $.ajax({
//                                url: "../data/system.aspx?method=LockCompany",
//                                type: "post",
//                                data: { id: ids, state: state },
//                                success: function (ret) {
//                                    mini.unmask(document.body);
//                                    if (ret == "out") {
//                                        var loginWindow = parent.mini.get("loginWindow");
//                                        if (!loginWindow.visible)
//                                            loginWindow.show();
//                                        return;
//                                    }
//                                    if (ret >= 0) {
//                                        ShowMessage("系统提示", "招聘企业" + msg + "成功！", 1);
//                                        grid.reload();
//                                        creatHtml();
//                                    }
//                                    else
//                                        ShowMessage("系统提示", "招聘企业" + msg + "失败！", 3);
//                                },
//                                error: function (XMLHttpRequest, textStatus, errorThrown) {
//                                    mini.unmask(document.body);
//                                    ShowMessage("系统提示", "招聘企业" + msg + "失败！", 3);
//                                }
//                            });
//                        }
//                    }
//                );
//            } else
//                ShowMessage("系统提示", "请选择需要" + msg + "的招聘企业！", 2);
//        }

        //批量免审/取消招聘企业
        function freeRows(state) {
            var rows = grid.getSelecteds();
            var msg = "免审";
            if (state == 0)
                msg = "取消免审";
            if (rows.length > 0) {
                mini.confirm("确定" + msg + "所选招聘企业吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].cu_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=OkCompany",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "招聘企业" + msg + "成功！", 1);
                                        grid.reload();
                                    }
                                    else
                                        ShowMessage("系统提示", "招聘企业" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "招聘企业" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
            } else
                ShowMessage("系统提示", "请选择需要" + msg + "的招聘企业！", 2);
        }

        //审核招聘企业
        function openCheck(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var form = new mini.Form("#checkform");
                var win = mini.get("checkWindow");
                if (!win.visible)
                    win.show();
                form.loading();
                form.clear();
                $.ajax({
                    url: "../data/system.aspx?method=GetCompany",
                    data: { id: row.cu_no },
                    success: function (text) {
                        form.unmask();
                        if (text == "out") {
                            win.hide();
                            var loginWindow = parent.mini.get("loginWindow");
                            if (!loginWindow.visible)
                                loginWindow.show();
                            return;
                        }
                        var o = mini.decode(text);
                        form.setData(o);
                        $("#check").html(o.cu_name);
                        if (o.cu_state != 2)
                            mini.get("cu_state").setValue(1);
                        mini.get("cu_ismoney").setChecked(true);
                        $(".tr1").show();
                    },
                    error: function () {
                        form.unmask();
                        ShowMessage("系统提示", "信息加载出错！", 3);
                    }
                });
            }
        }

        //保存审核招聘企业
        function updateCheck() {
            var win = mini.get("checkWindow");
            var form = new mini.Form("#checkform");
            form.validate();
            if (form.isValid() == false)
                return;
            var o = form.getData();
            var json = mini.encode(o);

            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '保存中，请稍后...' });
            $.ajax({
                url: "../data/system.aspx?method=UpdateCompany",
                data: { data: json },
                success: function (ret) {
                    mini.unmask(document.body);
                    if (ret == "out") {
                        var loginWindow = parent.mini.get("loginWindow");
                        if (!loginWindow.visible)
                            loginWindow.show();
                        return;
                    }
                    if (ret == 1) {
                        win.hide();
                        ShowMessage("系统提示", "会员审核成功！", 1);
                        grid.reload();
                        creatHtml();
                    }
                    else if (ret == 0) {
                        win.hide();
                        ShowMessage("系统提示", "该会员已不存在，请确认！", 2);
                        grid.reload();
                    }
                    else
                        ShowMessage("系统提示", "会员审核失败！", 3);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    mini.unmask(document.body);
                    ShowMessage("系统提示", "会员审核失败！", 3);
                }
            });
        }

        //关闭审核招聘企业
        function closeCheck() {
            var win = mini.get("checkWindow");
            var form = new mini.Form("#checkform");
            form.clear();
            if (win.visible)
                win.hide();
        }

        //管理招聘
        function recruitRows(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var tabs = parent.mini.get("mainTabs");
                var tab = tabs.getTab("tab$102");
                tab.enabled = false;
                showRTab(row.cu_no);
            }
        }

        //打开管理招聘Tab
        function showRTab(cu_no) {
            var tabs = parent.mini.get("mainTabs");
            var id = "tab$rec";
            var tab = tabs.getTab(id);
            if (!tab) {
                tab = {};
                tab.name = id;
                tab.title = "企业招聘职位管理";
                tab.showCloseButton = true;
                tab.url = "company/recruit.html?cuno=" + cu_no;
                tabs.addTab(tab);
            }
            tabs.activeTab(tab);
        }

        //新增企业缴费记录
        function openPay(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var win = mini.get("payWindow");
                var form = new mini.Form("#payform");
                if (!win.visible)
                    win.show();
                form.loading();
                form.clear();
                $.ajax({
                    url: "../data/system.aspx?method=GetCompany",
                    data: { id: row.cu_no },
                    success: function (text) {
                        form.unmask();
                        if (text == "out") {
                            win.hide();
                            var loginWindow = parent.mini.get("loginWindow");
                            if (!loginWindow.visible)
                                loginWindow.show();
                            return;
                        }
                        var o = mini.decode(text);
                        form.setData(o);
                        $("#pay").html(o.cu_name);
                        $("#kind").html(o.cl_name);
                    },
                    error: function () {
                        form.unmask();
                        ShowMessage("系统提示", "信息加载出错！", 3);
                    }
                });
            }
        }

        //保存企业缴费记录
        function updatePay() {
            var win = mini.get("payWindow");
            var form = new mini.Form("#payform");
            form.validate();
            if (form.isValid() == false)
                return;
            var o = form.getData();
            var json = mini.encode(o);
            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '保存中，请稍后...' });

            $.ajax({
                url: "../data/system.aspx?method=SaveCompanyPay",
                data: { data: json },
                success: function (ret) {
                    mini.unmask(document.body);
                    if (ret == "out") {
                        var loginWindow = parent.mini.get("loginWindow");
                        if (!loginWindow.visible)
                            loginWindow.show();
                        return;
                    }
                    if (ret > 0) {
                        win.hide();
                        ShowMessage("系统提示", "缴费记录保存成功！", 1);
                        grid.reload();
                    }
                    else if (ret == 0) {
                        win.hide();
                        ShowMessage("系统提示", "该单位已不存在，请确认！", 2);
                        grid.reload();
                    }
                    else
                        ShowMessage("系统提示", "缴费记录保存失败！", 3);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    mini.unmask(document.body);
                    ShowMessage("系统提示", "缴费记录保存失败！", 3);
                }
            });
        }

        function closePay() {
            var win = mini.get("payWindow");
            var form = new mini.Form("#payform");
            form.clear();
            if (win.visible)
                win.hide();
        }

        //审核记录查看
        function appRows(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var tabs = parent.mini.get("mainTabs");
                var tab = tabs.getTab("tab$102");
                tab.enabled = false;
                showATab(row.cu_no);
            }
        }

        //打开审核记录Tab
        function showATab(cu_no) {
            var tabs = parent.mini.get("mainTabs");
            var id = "tab$app";
            var tab = tabs.getTab(id);
            if (!tab) {
                tab = {};
                tab.name = id;
                tab.title = "企业审核记录";
                tab.showCloseButton = true;
                tab.url = "company/app.html?cuno=" + cu_no;
                tabs.addTab(tab);
            }
            tabs.activeTab(tab);
        }

        //缴费管理
        function payRows(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var tabs = parent.mini.get("mainTabs");
                var tab = tabs.getTab("tab$102");
                tab.enabled = false;
                showPTab(row.cu_no);
            }
        }

        //打开缴费管理Tab
        function showPTab(cu_no) {
            var tabs = parent.mini.get("mainTabs");
            var id = "tab$pay";
            var tab = tabs.getTab(id);
            if (!tab) {
                tab = {};
                tab.name = id;
                tab.title = "企业缴费记录管理";
                tab.showCloseButton = true;
                tab.url = "company/payment.html?cuno=" + cu_no;
                tabs.addTab(tab);
            }
            tabs.activeTab(tab);
        }

        //是否缴费切换
        function onValueChanged(e) {
            var checked = this.getChecked();
            if (checked) {
                $(".tr1").show();
            } else {
                $(".tr1").hide();
                if (!mini.get("cm_money").getValue())
                    mini.get("cm_money").setValue(0);
            }
        }

        //企业描色
//        function colorRows() {
//            var rows = grid.getSelecteds();
//            if (rows.length > 0) {
//                var form = new mini.Form("#colorform");
//                var win = mini.get("colorWindow");
//                if (!win.visible)
//                    win.show();
//                form.reset();
//            } else
//                ShowMessage("系统提示", "请选择需要描色的招聘企业！", 2);
//        }

//        //保存描色
//        function updateColor() {
//            var win = mini.get("colorWindow");
//            var form = new mini.Form("#colorform");
//            form.validate();
//            if (form.isValid() == false)
//                return;
//            var color = mini.getbyName("cu_color").getValue();
//            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '保存中，请稍后...' });
//            var rows = grid.getSelecteds();
//            var ids = "";
//            for (var i = 0; i < rows.length; i++) {
//                ids += rows[i].cu_no + ',';
//            }

//            $.ajax({
//                url: "../data/system.aspx?method=SaveCompanyColor",
//                type: "post",
//                data: { id: ids, color: color },
//                success: function (ret) {
//                    mini.unmask(document.body);
//                    if (ret == "out") {
//                        var loginWindow = parent.mini.get("loginWindow");
//                        if (!loginWindow.visible)
//                            loginWindow.show();
//                        return;
//                    }
//                    if (ret >= 0) {
//                        win.hide();
//                        ShowMessage("系统提示", "招聘企业描色成功！", 1);
//                        grid.reload();
//                        creatHtml();
//                    }
//                    else
//                        ShowMessage("系统提示", "招聘企业描色失败！", 3);
//                },
//                error: function (XMLHttpRequest, textStatus, errorThrown) {
//                    mini.unmask(document.body);
//                    ShowMessage("系统提示", "招聘企业描色失败！", 3);
//                }
//            });
//        }

        function closeColor() {
            var win = mini.get("colorWindow");
            var form = new mini.Form("#colorform");
            form.clear();
            if (win.visible)
                win.hide();
        }

        function creatHtml() {
            mini.confirm("是否生成首页静态页面？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '生成中，请稍后...' });
                        $.ajax({
                            url: "../data/system.aspx?method=CreateHtml",
                            type: "post",
                            data: { webset: webset },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret == 1) {
                                    ShowMessage("系统提示", "静态页面生成成功！", 1);
                                }
                                else
                                    ShowMessage("系统提示", "静态页面生成失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "静态页面生成失败！", 3);
                            }
                        });
                    }
                }
            );
        }

        //密码重置
        function resetPass() {
            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '保存中，请稍后...' });

            $.ajax({
                url: "../data/system.aspx?method=ResetPass",
                type: "post",
                data: { cuno: mini.get("cu_no").getValue() },
                success: function (ret) {
                    mini.unmask(document.body);
                    if (ret == "out") {
                        var loginWindow = parent.mini.get("loginWindow");
                        if (!loginWindow.visible)
                            loginWindow.show();
                        return;
                    }
                    if (ret == 1) {
                        ShowMessage("系统提示", "密码重置成功！", 1);
                    }
                    else if (ret == 0) {
                        $("#divList").show();
                        $("#editForm").hide();
                        form.clear();
                        ShowMessage("系统提示", "该招聘企业已不存在，请确认！", 2);
                        grid.reload();
                    }
                    else
                        ShowMessage("系统提示", "密码重置失败！", 3);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    mini.unmask(document.body);
                    ShowMessage("系统提示", "密码重置失败！", 3);
                }
            });
        }


//        function excelRow() {
//            mini.confirm("确定导出单位短信联系人手机号码吗？", "系统提示",
//                    function (action) {
//                        if (action == "ok") {
//                            $("#excelForm").submit();
//                        }
//                    }
//                );
//        }
    </script>
</html>
